package com.enation.app.shop.front.policyInsurance.webController;

import com.enation.app.base.core.model.Member;
import com.enation.app.shop.front.policyInsurance.layuiGrid.LayuiResponse;
import com.enation.app.shop.front.policyInsurance.layuiGrid.LayuiUtil;
import com.enation.app.shop.front.policyInsurance.service.InsuranceManageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Scope("prototype")
@Controller
@RequestMapping("web/insuranceMemberManage")
public class InsuranceMemberController {

    @Autowired
    private InsuranceManageMapper insuranceManageMapper;

    @ResponseBody
    @RequestMapping("/getAllMember")
    public ModelAndView getAllMember(){
        ModelAndView model=new ModelAndView("shop/admin/appinsurance/InsuranceMemberlist");
        return model;
    }

    @ResponseBody
    @RequestMapping("/getAllInsuranceMember")
    public LayuiUtil getAllInsuranceMember(Integer page,Integer limit,String name){
        List<Member> member=insuranceManageMapper.getAllInsuranceMember(page-1,limit,name);
        return LayuiResponse.getObjectMessageJson(member,"",member.size());
    }
}
